extends ../share/layout

block css
    <!-- Data Tables -->
    link(rel='stylesheet', href="/css/plugins/dataTables/dataTables.bootstrap.css")
    link(rel='stylesheet', href="/css/plugins/dataTables/dataTables.responsive.css")
    link(rel='stylesheet', href="/css/plugins/dataTables/dataTables.tableTools.min.css")

    <!-- Date Picker -->
    link(rel='stylesheet', href="/css/plugins/datepicker/datepicker3.css")

block crumb
  .col-lg-12
    ol.breadcrumb
      li
        a(href="/") Home
      li
        a(href="/") 销售管理
      li.active
        strong 销售单维护




block content
  .row
    div(class="col-lg-12)
      div(class="ibox float-e-margins",style="margin-bottom:0")
        div(class="ibox-title")
          .row
            .col-lg-3
              div(class="form-group form-xs",style="margin:0")
                div(class="input-group m-b",style="margin:0")
                  input(type="text",placeholder="订单编号...",class="form-control input-sm")
                  span.input-group-btn
                    button(type="button",class="btn btn-primary btn-sm") 快速查询
            .col-lg-3
              a(onclick="void(0);", href="javascript:void(0);", class="btn btn-primary btn-sm")
                i(class="fa fa-plus")   
                | &nbsp;新建销售单

            .col-lg-1
              销售总计:
              span(class="label label-info pull-right") 757791.02 $
            .col-lg-1
                成本总计:
                span(class="label label-warning pull-right") 757791.02 $

            div(class="ibox-tools",style="padding-right:20px;")
              a(class="collapse-link")
                i(class="fa fa-chevron-up")

        div(class="ibox-content")
          .row
            .col-lg-2
              .form-group
                label 收货人
                input(type="text",placeholder="收货人...",class="form-control input-sm")
              .form-group
                label 收货电话
                input(type="text",placeholder="收货电话...",class="form-control input-sm")

            .col-lg-2
              .form-group
                label 担当
                input(type="text",placeholder="担当...",class="form-control input-sm")
              .form-group
                label 物流单号
                input(type="text",placeholder="物流单号...",class="form-control input-sm")


            .col-lg-2
              .form-group
                label 状态
                select(class="form-control m-b input-sm",name="status")
                  option(value="") 所有
                  option(value="4000") 草稿
                  option(value="4010") 未打印 已下单
                  option(value="4020") 已打印 未发货
                  option(value="4030") 已发货
                  option(value="4040") 完成
                  option(value="4090") 退单

              .form-group
                label 支付方式
                select(class="form-control m-b input-sm",name="status")
                  option(value="") 所有
                  option(value="4000") 草稿
                  option(value="4010") 未打印 已下单
                  option(value="4020") 已打印 未发货
                  option(value="4030") 已发货
                  option(value="4040") 完成
                  option(value="4090") 退单


            .col-lg-3
              .form-group(id="date_5")
                label.font-noraml 订单日期
                div(class="input-daterange input-group",id="datepicker")
                  input(type="text",class="form-control input-sm",name="start",value="05/14/2016")
                  span.input-group-addon to
                  input(type="text",class="form-control input-sm",name="end",value="05/22/2016")
           
              .form-group
                label 收货地址
                input(type="text",placeholder="收货地址...",class="form-control input-sm")


            .col-lg-3
              .form-group
                label 店铺
                select(class="form-control m-b input-sm",name="status")
                  option(value="") 所有
                  option(value="4000") 草稿
                  option(value="4010") 未打印 已下单
                  option(value="4020") 已打印 未发货
                  option(value="4030") 已发货
                  option(value="4040") 完成
                  option(value="4090") 退单


          div(class="")
            a(onclick="get();", href="javascript:void(0);", class="btn btn-primary btn-sm")
              i(class="fa fa-search")   
              | &nbsp;搜索
            | &nbsp;&nbsp;
            a(onclick="void(0);", href="javascript:void(0);", class="btn btn-primary btn-sm")
              i(class="fa fa-dot-circle-o")   
              | &nbsp;清空条件

      div(class="row wrapper wrapper-content")
        .col-lg-12
          table(class="table table-striped table-bordered table-hover ",id="editable")
            thead
              tr
                th 单号
                th 状态
                th 下单时间
                th 物流单号
                th 物流费用
                th 金额
                th 成本
                th 支付方式
                th 会员编号
                th 收货人
                th 收货人电话
                th 担当
            tbody(id="grid")




block scripts
  script(src="/js/plugins/jeditable/jquery.jeditable.js")
  <!-- Data Tables -->
  script(src="/js/plugins/dataTables/jquery.dataTables.js")
  script(src="/js/plugins/dataTables/dataTables.bootstrap.js")
  script(src="/js/plugins/dataTables/dataTables.responsive.js")
  script(src="/js/plugins/dataTables/dataTables.tableTools.min.js")
   <!-- Data picker -->
  script(src="/js/plugins/datepicker/bootstrap-datepicker.js")


  // script begin *********************


  script.
    
    $(function(){

      $('#date_5 .input-daterange').datepicker({
          keyboardNavigation: false,
          forceParse: false,
          autoclose: true
      });

      //get();

    });

    var get = function(){

        var url = '/sale/order';

        $.getJSON(url, function (res) {

          var trHtml = '';
          
          $(res).each(function(i, item){
            trHtml += '<tr>';
            $(item).each(function(j,c){
              trHtml += '<td>' + c + '</td>';
            });
            trHtml += '</tr>';
          });

          $('#grid').html(trHtml);

          // init datatable
          inittable();

        }, 'json');
    }

    var inittable = function(){
      /* Init DataTables */
      var oTable = $('#editable').dataTable({"language": {
        "search": "搜索:"
      }});
    }
        
  // script end *********************

